package com.tongji.seller.utils
{
	import com.tongji.seller.view.twoD.Furniture;
	
	import flash.events.MouseEvent;
	
	import mx.core.DragSource;
	import mx.core.UIComponent;
	import mx.managers.DragManager;

	/**
	 * 
	 * @author yanghanbing
	 * 2011/08/
	 */ 
	public class DragDropManager
	{
		static private var ds:DragSource;

		static public function startDragFurniture(dragInitiator:UIComponent, event:MouseEvent, furniture:com.tongji.seller.view.twoD.Furniture):void
		{
			ds = new DragSource();
				
			//拖拽过程中缩放
			furniture.scaleX = 0.36;
			furniture.scaleY = 0.36;
			/*furniture.width = ConstVariableInventory.X_SCALE * furniture.content.width;
			furniture.height = ConstVariableInventory.Y_SCALE * furniture.content.height;*/
			
			ds.addData(furniture, "furnitureFormat");

			var offsetX:Number = ConstVariableInventory.DRAG_PICTURE_WIDTH - dragInitiator.mouseX;
			var offsetY:Number = ConstVariableInventory.DRAG_PICTURE_HEIGHT - dragInitiator.mouseY;

			DragManager.doDrag(dragInitiator, ds, event, furniture, -dragInitiator.mouseX, -dragInitiator.mouseY, 0.5);
		}

	}
}